package cn.wolfcode.wolf2w.conteoller;


import cn.wolfcode.wolf2w.domain.Destination;
import cn.wolfcode.wolf2w.domain.Region;
import cn.wolfcode.wolf2w.domain.Strategy;
import cn.wolfcode.wolf2w.domain.StrategyCatalog;
import cn.wolfcode.wolf2w.service.*;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/destinations")
public class DestinationController {
    @Autowired
    private IDestinationService destinationService ;
    @Autowired
    private IRegionService regionService ;
    @Autowired
    private IStrategyCatalogService strategyCatalogService;
    @Autowired
    private IStrategyService strategyService;
    @Autowired
    private ITravelService travelService ;

    @GetMapping("/hotRegion")
    public JsonResult hotRegion(){
        List<Region> list = regionService.queryHotRegion();
        return JsonResult.success(list) ;
    }

    @GetMapping("/search")
    public JsonResult search(String regionId){
        List<Destination> list =  destinationService.getDestByRegionId(regionId);

        return JsonResult.success(list) ;
    }

    @GetMapping("/toasts")
    public JsonResult getToasts(String destId){
        List<Destination> toasts = destinationService.getToasts(destId);
        return JsonResult.success(toasts) ;
    }
    @GetMapping("/catalogs")
    public JsonResult detail(String destId){
        List<StrategyCatalog> strategyCatalogs = strategyCatalogService.queryCatalogByDestId(destId);
        return JsonResult.success(strategyCatalogs) ;
    }
    @GetMapping("/strategies/viewnumTop3")
    public JsonResult viewnumTop3(String destId){
        List<Strategy> strategies = strategyService.queryViewnumTop3(destId);
        return JsonResult.success(strategies) ;
    }

    @GetMapping("/travels/viewnumTop3")
    public Object TravelsviewnumTop3(String destId){
        List<Strategy> strategies = travelService.queryViewnumTop3(destId);
        return JsonResult.success(strategies) ;
    }



}
